# -*- coding:utf-8 -*-
from django import forms
from captcha.fields import CaptchaField
from ckeditor_uploader.fields import RichTextUploadingFormField

from cookbook.models import MenuType


class LoginForm(forms.Form):
    username = forms.CharField(max_length=50, widget=forms.TextInput(attrs={'class': 'form-control'}))
    password = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    captcha = CaptchaField()


class RegisterForm(forms.Form):
    username = forms.CharField(max_length=50, widget=forms.TextInput(attrs={'class': 'form-control', 'autocomplete': 'off'}))
    email = forms.EmailField(widget=forms.EmailInput(attrs={'class': 'form-control'}))
    password = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control'}))


class ForgetForm(forms.Form):
    email = forms.EmailField(widget=forms.EmailInput(attrs={'class': 'form-control'}))
    captcha = CaptchaField()


class ResetForm(forms.Form):
    password1 = forms.CharField()
    password2 = forms.CharField()
    email = forms.EmailField()


class ReleaseMenuForm(forms.Form):
    name = forms.CharField(max_length=50, widget=forms.TextInput(attrs={'class': 'form-control'}))
    image = forms.ImageField(widget=forms.ClearableFileInput(attrs={'class': 'form-control'}), required=False)
    menu_type = forms.ModelChoiceField(queryset=MenuType.objects.all(), empty_label=u'选择类型',
                                       widget=forms.Select(attrs={'class': 'form-control'}))
    ingredients = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
    details = RichTextUploadingFormField()
